package beans;

import com.google.gson.Gson;

public class TeamMemberItemBean {
	private int id;
	private String name;
	private String email;
	private String password;
	private int roleId;
	private String roleName;
	private int projectId;
	private String projectName;
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getEmail() {
		return email;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public int getRoleId() {
		return roleId;
	}
	
	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}
	
	public String getRoleName() {
		return roleName;
	}
	
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	
	public int getProjectId() {
		return projectId;
	}
	
	public void setProjectId(int projectId) {
		this.projectId = projectId;
	}
	
	public String getProjectName() {
		return projectName;
	}
	
	public void setProjectName(String projectName) {
		if (projectName == null || projectName.isEmpty()) {
			this.projectName = "Not Assigned to a Project";
		}
		else {
			this.projectName = projectName;
		}
	}
	
	public String getJson() {
		StringBuffer sb = new StringBuffer();
		Gson gson = new Gson();
		
		sb.append("{");
		sb.append("\"id\": " + gson.toJson(id) + ",");
		sb.append("\"name\": " + gson.toJson(name) + ",");
		sb.append("\"email\": " + gson.toJson(email) + ",");
		sb.append("\"password\": " + gson.toJson(password) + ",");
		sb.append("\"role_id\": " + gson.toJson(roleId) + ",");
		sb.append("\"role_name\": " + gson.toJson(roleName) + ",");
		sb.append("\"project_id\": " + gson.toJson(projectId) + ",");
		sb.append("\"project_name\": " + gson.toJson(projectName));
		sb.append("}");
		
		return sb.toString();
	}
}
